package com.xx.bysj.utils;

import java.util.List;

public class Result {
    /*返回数据源*/
    private Integer code;
    private String message;
    private Object data;
    private int count;

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public int getCount() {
        return count;
    }

    public void setCount(int count) {
        this.count = count;
    }

    public Result() {
    }

    public Result(String message, Integer code, Object data) {
        this.message = message;
        this.code = code;
        this.data = data;
    }

    public Result(String message, Integer code, Object data,int count) {
        this.message = message;
        this.code = code;
        this.data = data;
        this.count = count;
    }
    public static Result success(String message){
        return new Result(message,NumberUtils.TWO_HUNDRED,null);
    }

    public static Result success(Object data){
        return new Result(null,NumberUtils.TWO_HUNDRED,data);
    }

    public static Result success(List<?> data){
        return new Result(null,NumberUtils.TWO_HUNDRED,data);
    }

    public static Result success(String message,Object data){
        return new Result(message,NumberUtils.TWO_HUNDRED,data);
    }

    public static Result success(String message, List<?> data){
        return new Result(message,NumberUtils.TWO_HUNDRED,data);
    }

    public static Result fail(String message){
        return new Result(message,NumberUtils.FIV_HUNDRED,null);
    }

    public static Result querySuccess(Object data){
        return new Result(null,NumberUtils.ZERO,data);
    }

    public static Result querySuccess(List<?> data,int count){
        return new Result(null,NumberUtils.ZERO,data,count);
    }
}
